//
//  UIColor+JColorToImage.m
//  HeadIndustry
//
//  Created by jun on 2017/8/27.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "UIColor+JColorToImage.h"

@implementation UIColor (JColorToImage)

// UIColor 转UIImage
+ (UIImage *) createImageWithColor: (UIColor *) color
{
    CGRect rect=CGRectMake(0,0, 1, 1);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}


@end
